<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <style>
        body {
            background-color: rgb(0, 1, 46);
            color: rgb(109, 177, 255);
        }

        div {
            width: 300px;
            height: 330px;
            margin: 10% auto;
            text-align: center;
            box-sizing: border-box;
            padding-right: 30px;
        }

        h1 {
            text-align: center;
            margin: 0;
        }

        button {
            width: 100%;
            border-radius: 3px;
            margin-top: 20px;
            background-color: rgb(109, 177, 255);
            border: 0;
        }

        button:hover {
            background-color: rgb(149, 198, 255);
            cursor: pointer;
        }

        input {

            height: 25px;
            border-radius: 3px;
            border: 0;
            margin: 10px 10px;
            background-color: rgb(109, 177, 255);
            padding-left: 10px;
            vertical-align: middle;
        }
    </style>
</head>

<body>
    <div>
        <h1>管理员登录</h1>
        账号：<input type="text"><br>
        密码：<input type="password"><br>
        记住密码：<input type="checkbox">
        自动登录：<input type="checkbox"><br>
        <button onclick="deng()">确认登录</button>
        <script src="https://code.jquery.com/jquery-3.7.1.js"></script>
        <script>
            var username = document.querySelectorAll('input')[0]
            var userpass = document.querySelectorAll('input')[1]
            var inp3 = document.querySelectorAll('input')[2]
            var inp4 = document.querySelectorAll('input')[3]
            var shu = JSON.parse(localStorage.getItem('1'))
            $('document').ready(function () {
                var jz = localStorage.getItem('jz')
                var zd = localStorage.getItem('zd')
                if (jz == "true" && zd == "false") {
                    console.log(111);
                    inp3.checked = true
                    username.value = shu.name
                    userpass.value = shu.password
                } else if (jz == "true" && zd == "true") {
                    location.assign('./首页.html')
                }
            })
            function deng() {
                console.log(shu.password);
                console.log(username.value == shu.name);
                localStorage.setItem('jz', false)
                localStorage.setItem('zd', false)
                if (inp3.checked) {
                    localStorage.setItem('jz', true)
                }
                if (inp3.checked == true && inp4.checked == true) {
                    localStorage.setItem('jz', true)
                    localStorage.setItem('zd', true)
                }
                if (shu.name == username.value && shu.password == userpass.value) {
                    location.assign('./首页.html')
                } else {
                    alert('账号或者密码不正确')
                }
            }

        </script>
    </div>
</body>

</html>